(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

U11(tt, M, N) → U12(tt, activate(M), activate(N))
U12(tt, M, N) → s(plus(activate(N), activate(M)))
plus(N, 0) → N
plus(N, s(M)) → U11(tt, M, N)
activate(X) → X

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

U11(tt, M, N) → U12(tt, activate(M), activate(N)) [1]
U12(tt, M, N) → s(plus(activate(N), activate(M))) [1]
plus(N, 0) → N [1]
plus(N, s(M)) → U11(tt, M, N) [1]
activate(X) → X [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

U11(tt, M, N) → U12(tt, activate(M), activate(N)) [1]
U12(tt, M, N) → s(plus(activate(N), activate(M))) [1]
plus(N, 0) → N [1]
plus(N, s(M)) → U11(tt, M, N) [1]
activate(X) → X [1]

The TRS has the following type information:
U11 :: tt → s:0 → s:0 → s:0
tt :: tt
U12 :: tt → s:0 → s:0 → s:0
activate :: s:0 → s:0
s :: s:0 → s:0
plus :: s:0 → s:0 → s:0
0 :: s:0

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants: none

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

U11(tt, M, N) → U12(tt, activate(M), activate(N)) [1]
U12(tt, M, N) → s(plus(activate(N), activate(M))) [1]
plus(N, 0) → N [1]
plus(N, s(M)) → U11(tt, M, N) [1]
activate(X) → X [1]

The TRS has the following type information:
U11 :: tt → s:0 → s:0 → s:0
tt :: tt
U12 :: tt → s:0 → s:0 → s:0
activate :: s:0 → s:0
s :: s:0 → s:0
plus :: s:0 → s:0 → s:0
0 :: s:0

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

tt => 0
0 => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

U11(z, z', z'') -{ 1 }→ U12(0, activate(M), activate(N)) :|: z' = M, z = 0, z'' = N, M >= 0, N >= 0
U12(z, z', z'') -{ 1 }→ 1 + plus(activate(N), activate(M)) :|: z' = M, z = 0, z'' = N, M >= 0, N >= 0
activate(z) -{ 1 }→ X :|: X >= 0, z = X
plus(z, z') -{ 1 }→ N :|: z = N, z' = 0, N >= 0
plus(z, z') -{ 1 }→ U11(0, M, N) :|: z' = 1 + M, z = N, M >= 0, N >= 0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1, V2),0,[fun(V, V1, V2, Out)],[V >= 0,V1 >= 0,V2 >= 0]).
eq(start(V, V1, V2),0,[fun1(V, V1, V2, Out)],[V >= 0,V1 >= 0,V2 >= 0]).
eq(start(V, V1, V2),0,[plus(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1, V2),0,[activate(V, Out)],[V >= 0]).
eq(fun(V, V1, V2, Out),1,[activate(M1, Ret1),activate(N1, Ret2),fun1(0, Ret1, Ret2, Ret)],[Out = Ret,V1 = M1,V = 0,V2 = N1,M1 >= 0,N1 >= 0]).
eq(fun1(V, V1, V2, Out),1,[activate(N2, Ret10),activate(M2, Ret11),plus(Ret10, Ret11, Ret12)],[Out = 1 + Ret12,V1 = M2,V = 0,V2 = N2,M2 >= 0,N2 >= 0]).
eq(plus(V, V1, Out),1,[],[Out = N3,V = N3,V1 = 0,N3 >= 0]).
eq(plus(V, V1, Out),1,[fun(0, M3, N4, Ret3)],[Out = Ret3,V1 = 1 + M3,V = N4,M3 >= 0,N4 >= 0]).
eq(activate(V, Out),1,[],[Out = X1,X1 >= 0,V = X1]).
input_output_vars(fun(V,V1,V2,Out),[V,V1,V2],[Out]).
input_output_vars(fun1(V,V1,V2,Out),[V,V1,V2],[Out]).
input_output_vars(plus(V,V1,Out),[V,V1],[Out]).
input_output_vars(activate(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [activate/2]
1. recursive : [fun/4,fun1/4,plus/3]
2. non_recursive : [start/3]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into plus/3
2. SCC is partially evaluated into start/3

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations plus/3
* CE 7 is refined into CE [8]
* CE 6 is refined into CE [9]


### Cost equations --> "Loop" of plus/3
* CEs [9] --> Loop 4
* CEs [8] --> Loop 5

### Ranking functions of CR plus(V,V1,Out)
* RF of phase [4]: [V1]

#### Partial ranking functions of CR plus(V,V1,Out)
* Partial RF of phase [4]:
- RF of loop [4:1]:
V1


### Specialization of cost equations start/3
* CE 2 is refined into CE [10,11]
* CE 3 is refined into CE [12,13]
* CE 4 is refined into CE [14,15]
* CE 5 is refined into CE [16]


### Cost equations --> "Loop" of start/3
* CEs [11,13] --> Loop 6
* CEs [10,12,14,15,16] --> Loop 7

### Ranking functions of CR start(V,V1,V2)

#### Partial ranking functions of CR start(V,V1,V2)


Computing Bounds
=====================================

#### Cost of chains of plus(V,V1,Out):
* Chain [[4],5]: 7*it(4)+1
Such that:it(4) =< V1

with precondition: [V+V1=Out,V>=0,V1>=1]

* Chain [5]: 1
with precondition: [V1=0,V=Out,V>=0]


#### Cost of chains of start(V,V1,V2):
* Chain [7]: 7*s(1)+7
Such that:s(1) =< V1

with precondition: [V>=0]

* Chain [6]: 14*s(2)+7
Such that:aux(1) =< V1
s(2) =< aux(1)

with precondition: [V=0,V1>=1,V2>=0]


Closed-form bounds of start(V,V1,V2):
-------------------------------------
* Chain [7] with precondition: [V>=0]
- Upper bound: nat(V1)*7+7
- Complexity: n
* Chain [6] with precondition: [V=0,V1>=1,V2>=0]
- Upper bound: 14*V1+7
- Complexity: n

### Maximum cost of start(V,V1,V2): nat(V1)*14+7
Asymptotic class: n
* Total analysis performed in 94 ms.

(10) BOUNDS(1, n^1)